#ifndef ROBOT_HPP
#define ROBOT_HPP

#include "Object.hpp"
#include "Cube.hpp"
#include "Cylinder.hpp"

#include "glm/glm.hpp"

#include <GL/glew.h>
#include <GL/freeglut.h>


class Robot : public Object
{
private:
  Cylinder * m_body;
  glm::mat4 bodyModel;
  
  Cylinder * m_frontWheel;
  Cylinder * m_leftWheel;
  Cylinder * m_rightWheel;

  Cube * m_leftArm;
  Cube * m_rightArm;
  
  
  Cube * m_head;
  
  float m_bodyRadius;
  float m_bodyHeight;
  float m_armHeight;
  float m_headHeight;
  float m_wheelDiam;
  float m_smallDim;
  
  glm::mat4 leftArmModel();
  glm::mat4 rightArmModel();

  enum State {Entering,
              RotatingToTable1,
              MovingToTable1,
              RotatingToTable2,
              MovingToTable2,
              RotatingAwayfromOrigin,
              ReversingToOrigin,
              RotatingToDoor,
              Leaving,
              Stop};
                   
  State m_state;
 
  
  glm::vec3 m_position;
  float m_armAngle;
  float m_bodyAngle;
  float m_param;  // distance along one of the triangle paths taken
                  // by robot
  
public:
 
  Robot(glm::mat4 model = glm::mat4(1.0f),
        Object * parent = 0);
  
  void updateRobot();
  glm::vec3 getPosition() {return m_position; }
  glm::mat4 getCameraModel();
  
  //virtual void draw(const glm::mat4 & modelview);
  
};

#endif // ROBOT_HPP